From 460dfabb87b3938595e076fac334bde48ab4757d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 18 May 2004 18:31:54 +0000 Subject: [PATCH] Restrict the width of the popup to be no larger than the monitor. 2004-05-18 Matthias Clasen * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): Restrict the width of the popup to be no larger than the monitor. (#142678, DmD Ljungmark) --- ChangeLog | 11 +++++++++++ ChangeLog.pre-2-10 | 11 +++++++++++ ChangeLog.pre-2-6 | 11 +++++++++++ ChangeLog.pre-2-8 | 11 +++++++++++ gtk/gtkentrycompletion.c | 20 ++++++++++---------- 5 files changed, 54 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6191420fa5..514ae5d960 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2004-05-18 Matthias Clasen + * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): + Restrict the width of the popup to be no larger than the + monitor. (#142678, DmD Ljungmark) + + * gtk/gtkbutton.c: Go back to the initial fix for the + focus-overdrawing problem, which was actually correct + according to docs/widget_geometry.txt. + + * gtk/gtkarrow.c (gtk_arrow_class_init): Bump the initial + arrow size from 11 to 15 to compensate for that. + * gtk/gtktextview.c (gtk_text_view_class_init): Document the arguments of the ::move-cursor signal. (#142725) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 6191420fa5..514ae5d960 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,16 @@ 2004-05-18 Matthias Clasen + * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): + Restrict the width of the popup to be no larger than the + monitor. (#142678, DmD Ljungmark) + + * gtk/gtkbutton.c: Go back to the initial fix for the + focus-overdrawing problem, which was actually correct + according to docs/widget_geometry.txt. + + * gtk/gtkarrow.c (gtk_arrow_class_init): Bump the initial + arrow size from 11 to 15 to compensate for that. + * gtk/gtktextview.c (gtk_text_view_class_init): Document the arguments of the ::move-cursor signal. (#142725) diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 6191420fa5..514ae5d960 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,16 @@ 2004-05-18 Matthias Clasen + * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): + Restrict the width of the popup to be no larger than the + monitor. (#142678, DmD Ljungmark) + + * gtk/gtkbutton.c: Go back to the initial fix for the + focus-overdrawing problem, which was actually correct + according to docs/widget_geometry.txt. + + * gtk/gtkarrow.c (gtk_arrow_class_init): Bump the initial + arrow size from 11 to 15 to compensate for that. + * gtk/gtktextview.c (gtk_text_view_class_init): Document the arguments of the ::move-cursor signal. (#142725) diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 6191420fa5..514ae5d960 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,16 @@ 2004-05-18 Matthias Clasen + * gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup): + Restrict the width of the popup to be no larger than the + monitor. (#142678, DmD Ljungmark) + + * gtk/gtkbutton.c: Go back to the initial fix for the + focus-overdrawing problem, which was actually correct + according to docs/widget_geometry.txt. + + * gtk/gtkarrow.c (gtk_arrow_class_init): Bump the initial + arrow size from 11 to 15 to compensate for that. + * gtk/gtktextview.c (gtk_text_view_class_init): Document the arguments of the ::move-cursor signal. (#142725) diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c index 1d1ab74ea1..d7cd492b92 100644 --- a/gtk/gtkentrycompletion.c +++ b/gtk/gtkentrycompletion.c @@ -1091,7 +1091,8 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion) GtkRequisition popup_req; GtkTreePath *path; gboolean above; - + gint width; + gdk_window_get_origin (completion->priv->entry->window, &x, &y); get_borders (GTK_ENTRY (completion->priv->entry), &x_border, &y_border); @@ -1110,9 +1111,14 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion) else gtk_widget_show (completion->priv->scrolled_window); + screen = gtk_widget_get_screen (GTK_WIDGET (completion->priv->entry)); + monitor_num = gdk_screen_get_monitor_at_window (screen, + GTK_WIDGET (completion->priv->entry)->window); + gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); + + width = MIN (completion->priv->entry->allocation.width, monitor.width); gtk_widget_set_size_request (completion->priv->tree_view, - completion->priv->entry->allocation.width - 2 * x_border, - items * height); + width - 2 * x_border, items * height); /* default on no match */ completion->priv->current_selected = -1; @@ -1128,18 +1134,12 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion) &height); gtk_widget_set_size_request (completion->priv->action_view, - completion->priv->entry->allocation.width - 2 * x_border, - items * height); + width - 2 * x_border, items * height); } else gtk_widget_hide (completion->priv->action_view); gtk_widget_size_request (completion->priv->popup_window, &popup_req); - - screen = gtk_widget_get_screen (GTK_WIDGET (completion->priv->entry)); - monitor_num = gdk_screen_get_monitor_at_window (screen, - GTK_WIDGET (completion->priv->entry)->window); - gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); if (x < monitor.x) x = monitor.x; -- 2.30.2